import { useSocket } from '@/hooks/useSocket';
import { useGlobalStore } from '@/store';
import { Button, DatePicker } from 'antd';
import { useEffect } from 'react';
import { useTranslation } from 'react-i18next';

const Home: React.FC = () => {
	const language = useGlobalStore(state => state.language);
	const setLanguage = useGlobalStore(state => state.setLanguage);
	const socket = useSocket();

	const { t } = useTranslation();

	useEffect(() => {
		console.log(3242, socket);
	}, [socket]);

	return (
		<div className="text-red">
			<p className="text-20">当前语言: {language}</p>
			<span>{t('common.title')}</span>
			<DatePicker />
			<Button onClick={() => setLanguage(language === 'zh-CN' ? 'en' : 'zh-CN')}>切换语言</Button>
		</div>
	);
};

export default Home;
